package com.sys.basics.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;

/**
 * @author: ares
 * @date: 2021-10-08
 * @description: 附件资源表 实体
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_attachment")
@ApiModel(value = "SysAttachment对象", description = "附件资源表")
public class SysAttachment implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "组织id：主要区分不同组织创建各自的资源库")
    @TableField("org_id")
    private Long orgId;

    @ApiModelProperty(value = "父id")
    @TableField("parent_id")
    private Long parentId;

    @ApiModelProperty(value = "名称")
    @TableField("name")
    private String name;

    @ApiModelProperty(value = "mime")
    @TableField("mime")
    private String mime;

    @ApiModelProperty(value = "后缀")
    @TableField("ext")
    private String ext;

    @ApiModelProperty(value = "大小")
    @TableField("size")
    private Integer size;

    @ApiModelProperty(value = "像素")
    @TableField("pixel")
    private String pixel;

    @ApiModelProperty(value = "哈希值")
    @TableField("hash")
    private String hash;

    @ApiModelProperty(value = "外链")
    @TableField("url")
    private String url;

    @ApiModelProperty(value = "协议")
    @TableField("protocol")
    private String protocol;

    @ApiModelProperty(value = "0=图片 1=附件 2=目录 3=视频")
    @TableField("type")
    private Integer type;

    @ApiModelProperty(value = "优先权 0>1")
    @TableField("priority")
    private Integer priority;

    @ApiModelProperty(value = "封面")
    @TableField("cover")
    private String cover;

    @ApiModelProperty(value = "排序")
    @TableField("sort")
    private Integer sort;

    @ApiModelProperty(value = "默认目录 0=否 1=是")
    @TableField("is_default")
    private Integer isDefault;

    @ApiModelProperty(value = "乐观锁(版本号)")
    @TableField("version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified;

    @ApiModelProperty(value = "创建者id")
    @TableField(value = "creator_id", fill = FieldFill.INSERT)
    private Long creatorId;

    @ApiModelProperty(value = "修改者id")
    @TableField(value = "modifier_id", fill = FieldFill.INSERT_UPDATE)
    private Long modifierId;

    @ApiModelProperty(hidden = true)
    @TableField(exist = false) // mybatis plus 注解,. 表明此字段在数据库中不存在
    private List<SysAttachment> children;
}
